package cn.itcast.model.bean

//inType=HBase
//zkHosts=192.168.10.20
//zkPort=2181
//hbaseTable=tbl_users
//family=detail
//selectFields=id,gender
//1.先alt+鼠标选择需要的列,
//2.用ctrl+shift+左/右(箭头)选择整个单词
case class HBaseMeta(
                      inType: String, //当前数据源的类型
                      zkHosts: String, //zk的主机地址
                      zkPort: String, //zk的端口号
                      hbaseTable: String, //Hbase的表名
                      family: String, //表的列簇名字
                      selectFields: String //我们需要选择的列: 多个列需要用","分割
                    )
object HBaseMeta{

  //定义参数的名字
  //转换大小写 ctrl+shift+u
  val INTYPE = "inType"
  val ZKHOSTS = "zkHosts"
  val ZKPORT = "zkPort"
  val HBASETABLE = "hbaseTable"
  val FAMILY = "family"
  val SELECTFIELDS = "selectFields"




  def apply(map: Map[String, String]): HBaseMeta = {
    //从Map中获取HBaseMeta的信息
    HBaseMeta(
      map.getOrElse(HBaseMeta.INTYPE, ""),
      map.getOrElse(HBaseMeta.ZKHOSTS, ""),
      map.getOrElse(HBaseMeta.ZKPORT, ""),
      map.getOrElse(HBaseMeta.HBASETABLE, ""),
      map.getOrElse(HBaseMeta.FAMILY, ""),
      map.getOrElse(HBaseMeta.SELECTFIELDS, "")
    )
  }


}